package org.hyf.inspur.LessonDesin.clear.count2;

import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Reducer;
import org.hyf.inspur.LessonDesin.clear.tools.TProperties;

import java.io.IOException;
import java.util.Iterator;

public class UvReducer extends Reducer<Text,Text,Text, NullWritable> {


    protected void reduce(Text key, Iterable<Text> values, Context context) throws IOException, InterruptedException {
        Iterator<Text> it = values.iterator();
        int count = 0;
        int Pvcount = 0;
        while (it.hasNext()) {
            Text temp = it.next();
            int sb = Integer.parseInt(String.valueOf(temp));
            Pvcount += sb;
            count++;
        }
        String str = key+TProperties.getValue("outfilesplit")+count+TProperties.getValue("outfilesplit")+Pvcount;
        context.write(new Text(str),NullWritable.get());
    }

}
